<?php

Class ShowAction extends CommonAction{
    public function index(){
        import('ORG.Util.Page');
        $count = M('app')->count();
//        echo $count;die;
        $page = new Page($count,2);

        $limit = $page->firstRow.','.$page->listRows;

        $app = M('app')->order('time DESC')->limit($limit)->select();
        $this->app = $app;
        $this->page = $page->show();
//        p($app);die;
        $this->display();
    }

    public function delete(){
        $id = I('id','','intval');
//        M('app')->where(array('id'=>$id))->delete();若条件为主键可用以下写法
        if(M('app')->delete($id)){
            $this->success('删除成功',U('Admin/Show/index'));
        }else{
            $this->error('删除失败');
        }

    }
}

?>